home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4626 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  987 b 

  1. Path: pc0734.ri.bbsrc.ac.uk!user
  2. From: Andy.Law@bbsrc.ac.uk (Andy Law)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Incrementing enumerated types
  5. Date: Wed, 31 Jan 1996 11:38:30 +0000
  6. Organization: Roslin Institute
  7. Message-ID: <Andy.Law-3101961138310001@pc0734.ri.bbsrc.ac.uk>
  8. Reply-To: Andy.Law@bbsrc.ac.uk
  9. NNTP-Posting-Host: pc0734.ri.bbsrc.ac.uk
  10. X-Newsreader: Yet Another NewsWatcher 2.1.8
  11.  
  12. Is it legal to increment an enumerated type? I have an enumerated list of
  13. possible document types that I want to step through, and my compiler is
  14. barfing on it. It seems such a waste of an enumeration if I have to resort
  15. to ints to get this done.
  16.  
  17. Alternatively does anyone have a suggestion as to how to do this kind of
  18. thing legally?
  19.  
  20. for (EnumeratedType eIndex = enum_first; eIndex < enum_last; eIndex++) {
  21.                                                              ^^^^^^^^
  22.     /* do something */
  23. }
  24.  
  25. TIA,
  26.  
  27. Andy Law
  28. ------------------
  29. ( Andy.Law@bbsrc.ac.uk )
  30. ( Big Nose in Edinburgh )
  31.